import Vue from 'vue'
import Vuex from 'vuex'
import FormComponentName from "@/components/FormComponentName";

Vue.use(Vuex)
//导出vuex对象树
// 创建一个新的 store 实例
const store = new Vuex.Store({
  state() {
    return {
      nodeTree: [{
        component: FormComponentName.StartEvent
      }],
      NodeSelectDialog:{
        locationX:0,
        locationY:0,
        visible:false
      }
    }
  },
  mutations: {
    addComponent(state, component) {
      state.nodeTree.push({
        component
      })
    },
    showNodeSelectDialog(state, locationX, locationY) {
      state.NodeSelectDialog.locationX = locationX
      state.NodeSelectDialog.locationY = locationY
      state.NodeSelectDialog.visible = true
    },
    hideNodeSelectDialog(state){
      state.NodeSelectDialog.visible = false
    }
  }
})

export default store



